package com.kkwrite.regimen.provider.controller.collection;

import java.util.List;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.kkwrite.regimen.common.entity.dto.OutDTO;
import com.kkwrite.regimen.common.entity.dto.collection.CollectionDTO;
import com.kkwrite.regimen.provider.exception.ServiceException;
import com.kkwrite.regimen.provider.service.collection.CollectionService;

/** 
 * 项目用户代言
 *
 * @author jinying
 */
@RestController
@RequestMapping("/collection")
public class CollectionController {

	private static final Logger logger = LoggerFactory.getLogger(CollectionController.class);
	
	@Resource(name = "collectionService")
	private CollectionService collectionService;
	
	@GetMapping("/getCollection")
	public OutDTO<List<CollectionDTO>> getCollection(Long userId,@RequestParam Integer collectOwnerType) throws ServiceException {
		
		OutDTO<List<CollectionDTO>> outDTO = new OutDTO<>();
		List<CollectionDTO> collectionDTOList = collectionService.queryCollection(userId,collectOwnerType);
		outDTO.setSuccess("true");
		outDTO.setData(collectionDTOList);
		
		return outDTO;
	}
	
}
